package com.inforich.screenData.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.inforich.common.utils.DateUtils;
import com.inforich.screenData.domain.ReportView;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.inforich.screenData.mapper.ReportCarTransportMapper;
import com.inforich.screenData.domain.ReportCarTransport;
import com.inforich.screenData.service.IReportCarTransportService;

/**
 * 车辆运输日汇总Service业务层处理
 *
 * @author hjm
 * @date 2022-10-27
 */
@Service
public class ReportCarTransportServiceImpl extends
    ServiceImpl<ReportCarTransportMapper, ReportCarTransport> implements
    IReportCarTransportService {

  @Override
  public Page<ReportCarTransport> pageReportCarTransport(Page<ReportCarTransport> page,
      Map<String, Object> map) {
    return baseMapper.pageReportCarTransport(page, map);
  }

  @Override
  public List<ReportCarTransport> listReportCarTransport(Map<String, Object> map) {
    return baseMapper.listReportCarTransport(map);
  }

  @Override
  public Boolean checkConflict(ReportCarTransport reportCarTransport) {
    return this.count(
        new LambdaQueryWrapper<ReportCarTransport>().eq(ReportCarTransport::getStatisticsDate,
                DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, reportCarTransport.getStatisticsDate()))
            .ne(reportCarTransport.getId() != null, ReportCarTransport::getId,
                reportCarTransport.getId())) > 0;
  }


}
